//
//  CellForDetali.m
//  MY Project For Sport
//
//  Created by dllo on 16/2/27.
//  Copyright © 2016年 dilo. All rights reserved.
//

#import "CellForDetali.h"
#import <SDWebImage/UIImageView+WebCache.h>
#import <DKNightVersion.h>
#import "ModelForDetailsNews.h"

#define WEIGHTT [UIScreen mainScreen].bounds.size.width / 375
#define HEIGHTT [UIScreen mainScreen].bounds.size.height / 667


@interface CellForDetali ()

@property (nonatomic, retain) UILabel *content;
@property (nonatomic, retain) UIImageView *imageViewForHot;




@end

@implementation CellForDetali

- (void)dealloc {

    [_content release];
    [_imageViewForHot release];

    
    [super dealloc];

}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.contentView.dk_backgroundColorPicker = DKColorWithRGB (0xffffff, 0x343434);
        [self createSubview];
        
    }
    return self;
    
}

- (void)createSubview {
    
    self.imageViewForHot = [[UIImageView alloc] init];
    [self.contentView addSubview:self.imageViewForHot];
    [_imageViewForHot release];
    
    
    self.content = [[UILabel alloc] init];
    [self.contentView addSubview:self.content];
    [_content release];
    
    
}
- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    self.imageViewForHot.frame = CGRectMake(5 * WEIGHTT, 5 * HEIGHTT, self.contentView.frame.size.width / 4, self.contentView.frame.size.height - 10 * HEIGHTT);

    self.content.font = [UIFont systemFontOfSize:16];
    self.content.textColor = [UIColor grayColor];
    self.content.numberOfLines = 0;
    self.content.frame = CGRectMake(self.contentView.frame.size.width / 4 + 10 * WEIGHTT, 5 * HEIGHTT, self.contentView.frame.size.width - self.contentView.frame.size.width / 4 - 15 * WEIGHTT  , self.contentView.frame.size.height - 25 * HEIGHTT);

    
}


- (void)passModelForDetali:(ModelForDetailsNews *)model {
    
    
    [self.imageViewForHot sd_setImageWithURL:[NSURL URLWithString:model.image]];
    
    self.content.text = model.summary;
    


}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
